﻿Imports System.Data
Imports System.Data.SqlClient
Imports _0971023_0971029.NguoiChoThue_DAO
Public Class NhaChoThue_BUS
    Public Shared Function loadDuLieuNguoiChoThue() As DataTable
        Dim bang As DataTable = NguoiChoThue_DAO.LoadNguoiChoThue()
        Return bang
    End Function
    Public Shared Function layDLExeclNguoiChoThue(ByVal nha As NguoiChoThue_DTO) As Boolean
        Dim bang As Boolean = NguoiChoThue_DAO.LayDLExcelNguoiChoThue(nha)
        If bang = False Then
            MessageBox.Show("lưu không thành công!")
        Else
            Return bang
        End If
    End Function
    Public Shared Function loadmaNha() As DataTable
        Dim bang As DataTable = NguoiChoThue_DAO.LoadMaNha()
        Return bang
    End Function
    Public Shared Function loadDuLieuComBoxNguoiChoThue() As DataTable
        Dim bang As DataTable = NguoiChoThue_DAO.LoadDuLieuLenCMBData()
        Return bang
    End Function
    Public Shared Sub ThemDuLieu(ByVal NguoiChothue As NguoiChoThue_DTO)
        Dim i As Boolean = NguoiChoThue_DAO.ChenDuLieuNguoiChoThue(NguoiChothue)
        If (i = True) Then
            MessageBox.Show(" bạn đã thêm thành công!")
        Else
            MessageBox.Show(" đã có lỗi khi thêm dữ liệu", "thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
    End Sub
    Public Shared Sub updateDuLieu(ByVal NguoiChothue1 As NguoiChoThue_DTO)
        Dim i As Boolean = NguoiChoThue_DAO.UpdateDuLieuNguoiChoThue(NguoiChothue1)
        If (i = True) Then
            MessageBox.Show(" bạn đã thêm thành công!")
        Else
            MessageBox.Show(" đã có lỗi khi thêm dữ liệu", "thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
    End Sub
    Public Shared Function deleteDuLieu(ByVal MaNguoiChothue As Integer) As Boolean
        Dim i As Boolean = NguoiChoThue_DAO.deleteDuLieuNguoiChoThue(MaNguoiChothue)
        If (i = True) Then
            Return True
        Else
            MessageBox.Show(" đã có lỗi khi thêm dữ liệu", "thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Return False
        End If
    End Function
    Public Shared Function LayThongTinTimKiemGia(ByVal giamax As Integer, ByVal giamin As Integer) As DataTable

        Dim i As DataTable = NguoiChoThue_DAO.LoadThongTinTimKiemGia(giamax, giamin)

        Return i

    End Function
    Public Shared Function LayThongTinTimKiemDiaChi(ByVal Dc As String) As DataTable

        Dim i As DataTable = NguoiChoThue_DAO.LoadThongTinTimkiemdiachi(Dc)
        'If i.Columns.Count <> 0 Then

        Return i
        'Else
        'MessageBox.Show("không tìm thấy dữ liệu")
        'End If

    End Function
    Public Shared Function LayThongTinTimKiemNguoiO(ByVal Dc As Integer) As DataTable

        Dim i As DataTable = NguoiChoThue_DAO.LoadThongTinTimkiemNguoiO(Dc)
        'If i.Columns.Count <> 0 Then

        Return i
        'Else
        'MessageBox.Show("không tìm thấy dữ liệu")
        'End If


    End Function
    Public Shared Function laodgia() As DataTable
        Dim bang As DataTable = NguoiChoThue_DAO.LoadGia()
        Return bang
    End Function
    Public Shared Function laodgia1() As DataTable
        Dim bang As DataTable = NguoiChoThue_DAO.LoadGia1()
        Return bang
    End Function
End Class
